/**
 * @author Maximilian Csuk
 * @author Bernhard Denner
 * @author Konrad Paumann
 */
public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
//		BinTree<MyInteger> t = new BinTree<MyInteger>(new MyInteger(50));
		OutputHandler out = new OutputHandler();
		
		out.print("Test 1:");
		BinTree<MyInteger> ti = new BinTree<MyInteger>();
		ti.insert(new MyInteger(15));
		ti.insert(new MyInteger(9));
		ti.insert(new MyInteger(5));
		ti.insert(new MyInteger(3));
		ti.insert(new MyInteger(6));
		ti.insert(new MyInteger(14));
		ti.insert(new MyInteger(13));
		ti.insert(new MyInteger(12));
		ti.insert(new MyInteger(10));
		ti.insert(new MyInteger(20));
		ti.insert(new MyInteger(16));
		ti.insert(new MyInteger(22));
		ti.insert(new MyInteger(21));
		ti.insert(new MyInteger(30));
		ti.insert(new MyInteger(15));
		ti.insert(new MyInteger(5));
		ti.insert(new MyInteger(15));
		
		ti.delete(new MyInteger(14));
		ti.delete(new MyInteger(9));

		out.print("Tree with MyInteger:");
		out.print(ti.toString());
		
		
		BinTree<MyString> ts = new BinTree<MyString>();
		ts.insert(new MyString("a"));
		ts.insert(new MyString("d"));
		ts.insert(new MyString("x"));
		ts.insert(new MyString("k"));
		ts.insert(new MyString("b"));
		ts.insert(new MyString("l"));
		ts.insert(new MyString("R"));
		ts.insert(new MyString("h"));
		ts.insert(new MyString("u"));
		ts.insert(new MyString("e"));
		ts.insert(new MyString("o"));
		ts.insert(new MyString("p"));
		ts.insert(new MyString("X"));
		ts.insert(new MyString("e"));
		ts.insert(new MyString("z"));
		ts.insert(new MyString("o"));
		ts.insert(new MyString("F"));
		ts.insert(new MyString("a"));
		ts.insert(new MyString("e"));
		ts.insert(new MyString("z"));
		ts.insert(new MyString("F"));
		ts.insert(new MyString("a"));
		
		ts.delete(new MyString("o"));
		ts.delete(new MyString("a"));
		ts.delete(new MyString("b"));
		ts.delete(new MyString("X"));
		
		out.print("Tree with MyString:");
		out.print(ts.toString());
		
		out.print("Test 2:");
		out.print("starting 4 insert threads and 2 delete threads");		
		BinTree<MyInteger> t = new BinTree<MyInteger>();
		
		for(int i = 1;i <= 4;i++) {
			new Thread(new IntBinTreeInserter(t, out, i)).start();
			if (i % 2 == 1)
				new Thread(new IntBinTreeDeleter(t, out, i)).start();
		}
		
	}
	

}
